# 导入鸢尾花数据集
# P8 特征工程
import sklearn.model_selection
from sklearn.datasets import load_iris


def datasets_demo():
    # 加载获取流行数据集 获取小数据集
    iris = load_iris()
    # print("数据集中的数据", iris.data)
    # 二维数组 长度150，宽度4
    # print("特征值:", iris.data.shape)
    # print("目标值:", iris.target)
    # 划分数据集[8:2划分]  random_state [随机数种子]  最终需要对模型进行评估
    # [x_train,y_train] 训练集  [x_test,y_test] 测试集

    x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(iris.data, iris.target, test_size=0.2,
                                                                                random_state=22)
    print(x_train.shape)
    print(x_test.shape)

    return None


def datasets_fetch():
    # 联网加载 获取大数据集
    # subset [test测试集/train训练集 all 包含训练集和测试集]
    datasets = sklearn.datasets.fetch_20newsgroups(data_home="scikit_learn_data", subset="train")
    return None


if __name__ == '__main__':
    datasets_demo()
